/* eslint-disable prefer-const */
/*
 * @Author: MarioGo
 * @Date: 2021-11-20 08:37:40
 * @LastEditTime: 2021-11-20 13:53:12
 * @LastEditors: MarioGo
 * @Description: 文件描述
 * @FilePath: /zheye/src/test.ts
 * 可以输入预定的版权声明、个性签名、空行等
 */

interface ListProps {
  des: string;
}

interface FaPorps {
  id?: number;
  name?: string;
  list?: ListProps[];
}

async function fa(): Promise<FaPorps | null> {
  return {
    id: 999,
    name: 'jack',
    list: [{ des: 'xxxx' }],
  };
}

async function fb(): Promise<boolean> {
  return true;
}

async function main() {
  let a: FaPorps | null;
  let b: boolean;

  // Remove this "as const" and the code won't compile.
  [a, b] = await Promise.all([fa(), fb()] as const);

  console.log(a, b);
  return { a, b };
}

main();
